<?php
# http://projects:8081/cdapp-2kt-api/api/_version.php
include_once './_portal.php';

$new_version = isset($_GET['v']) ? $_GET['v'] : null;
$old_version = param('APP_VERSION');
if ($new_version) {
  if ($new_version != $old_version) {
    param('APP_VERSION', $new_version);
    output(array('action' => 'set', 'status' => 'ok', 'version' => $new_version));
  } else {
    output(array('action' => 'set', 'status' => 'failed', 'version' => $old_version));
  }
} else {
  output(array('action' => 'get', 'status' => 'ok', 'version' => $old_version));
}
